<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <script>
        //判断5 是不是素数
        function sushu (x){
        var x = 5;
        var flag = true;
        for(var b=2; b < x; b++){
            if (x % b == 0) {
                flag = false;
                break;
                }
            }
        }
        for(var x = 5; x < 7; x++){
            var res = sushu;
        }
        if(res == false){
            console.log(x+'是素数');
        }

    </script>   

    <script>
        var num = 5298741;
        console.log(~~((num %10000) /1000));
    </script>

    <script>
        function shuixian(num){
        //个位
        var 个位 = num %10;
        //十位
        var 十位 = parseInt(num %100 /10);
        //百位
        var 百位 = parseInt(num / 100);

        var sum = 个位**3 + 十位**3 + 百位**3;

        if (sum == num){
            console.log(num+'是水仙花数');
        }
    }
    </script>
    <script>
        
        for(var num = 100 ; num <= 999; num++){
            var res = shuixian(num);
        }

        if (res==true){
            console.log(num+'是水仙花数');
        }
    </script>
    <script>
        for(var i = 0; i < 5; i++){
            for(var j = 0; j < 5 - i; j++){
                document.write('*');
            }

            document.write('<br />');
        }
        document.write('<br />');
    </script>

    <script>
        for(var i = -3; i <= 3; i++){

            var tmp = i;

            if( tmp < 0 ){
                tmp *= -1;
            }

            for(var j = 0; j < 4 - tmp; j++){
                document.write('*');
            }

            document.write('<br />');

        }    
        document.write('<br />');
    </script>

    <script>
        for(var i = 0; i < 5; i++){

            // (内循环1)输出 - 
            for(var k = 0; k < i; k++){
                document.write('-');
            }

            // (内循环2)输出 * 
            for(var j = 0; j < 5 - i; j++){
                document.write('*');
            }

            for(var k = 0; k < i; k++){
                document.write('-');
            }

            document.write('<br />');
        }
        document.write('<hr />');
    </script>

    <script>
        
        
        for(var i = -5; i <= 5; i++){
            document.write(i+' ');
        }
        document.write('<br />');


         
        for(var i = -5; i <= 5; i++){
            
            var tmp = i;

            if(tmp < 0){
                tmp *= -1;
            }

            document.write(tmp+' ');
        }
        document.write('<br />');
    </script>
</body>
</html>